﻿using AutoMapper;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AutoMapperTest
{
    class Program
    {
        static void Main(string[] args)
        {
            Stopwatch sw = new Stopwatch();
            sw.Start();
            Dictionary<int, string> d = new Dictionary<int, string>();
            for (int i = 0; i < 300000; i++)
            {
                d.Add(i, i.ToString());
            }
            Console.WriteLine(sw.ElapsedMilliseconds);
            Console.WriteLine("write done:"+d.Count);
            sw.Restart();
            string val;
            for (int i = 0; i < 300000; i++)
            {
                val=d[i];
            }
            Console.WriteLine(sw.ElapsedMilliseconds);
            Console.WriteLine("read done");
            sw.Stop();
            Console.ReadLine();
        }

        private static void AutoMap()
        {
            Order o = new Order();
            OrderBaseInfoDTO odto = new OrderBaseInfoDTO();
            Mapper.CreateMap<Order, OrderBaseInfoDTO>();
            Mapper.Map<Order, OrderBaseInfoDTO>(o, odto);
            Console.ReadLine();
        }
    }

    public partial class Order
    {
        /// <summary>
        /// 订单号
        /// </summary>
        public long OrderId { get; set; }

        /// <summary>
        /// 预订日期
        /// </summary>
        public DateTime OrderDate { get; set; }

        /// <summary>
        /// 订单简述
        /// </summary>
        public string OrderName { get; set; }

        /// <summary>
        /// 订单总卖价，包含订单已收已付之前手动产生的卖价调整金额，不包含订单已收已付之后系统自动产生的卖价调整金额
        /// </summary>
        public decimal Amount { get; set; }

        /// <summary>
        /// 送票费用
        /// </summary>
        public decimal SendTicketFee { get; set; }

        /// <summary>
        /// 订单使用的游票金额
        /// </summary>
        public decimal TMoney { get; set; }

        /// <summary>
        /// 最早使用日期
        /// </summary>
        public DateTime UseDateOfFirst { get; set; }

        /// <summary>
        /// 最晚使用日期
        /// </summary>
        public DateTime? UseDateOfLast { get; set; }


        /// <summary>
        /// 登录用户名
        /// </summary>
        public string Uid { get; set; }

        /// <summary>
        /// 订单确认方式1001：不需要确认 1002：手机短信确认 1003：电话确认 1004 Email确认
        /// </summary>
        public int ConfirmWay { get; set; }

        /// <summary>
        /// Ctrip卡号
        /// </summary>
        public string CtripCardNo { get; set; }

        /// <summary>
        /// 人数
        /// </summary>
        public int Quantity { get; set; }

        /// <summary>
        /// 联系人确认方式 NON=不用确认 CSM=短信确认 TEL=电话确认 EML=邮件确认 FAX=传真确认
        /// </summary>
        public string ConfirmType { get; set; }

        /// <summary>
        /// 联系人名字
        /// </summary>
        public string ContactName { get; set; }

        /// <summary>
        /// 联系人电话
        /// </summary>
        public string ContactTel { get; set; }

        /// <summary>
        /// 联系人传真
        /// </summary>
        public string ContactFax { get; set; }

        /// <summary>
        /// 联系人手机
        /// </summary>
        public string ContactMobile { get; set; }

        /// <summary>
        /// 联系人Email
        /// </summary>
        public string ContactEmail { get; set; }

        /// <summary>
        /// 联系人地址
        /// </summary>
        public string ContactAddress { get; set; }

        /// <summary>
        /// 取票方式 SND=市内配送 NUL=不取不送 JOU=邮寄行程单 EMS GET=市内自取
        /// </summary>
        public string GetTicketType { get; set; }

        /// <summary>
        /// 备注
        /// </summary>
        public string Remarks { get; set; }

        /// <summary>
        /// 送票时间开始
        /// </summary>
        public DateTime SendTicketETime { get; set; }

        /// <summary>
        /// 送票时间结束
        /// </summary>
        public DateTime SendTicketLTime { get; set; }

        /// <summary>
        /// 客户等级 0=普通 10=金牌 20=白金 30=钻石
        /// </summary>
        public short VipGrade { get; set; }

        /// <summary>
        /// 卖价币种
        /// </summary>
        public string Currency { get; set; }

        /// <summary>
        /// 最晚回复时间
        /// </summary>
        public DateTime ClientConfirmDueDate { get; set; }

        /// <summary>
        /// EMS邮编
        /// </summary>
        public string ContactZipCode { get; set; }

        /// <summary>
        /// 行政区
        /// </summary>
        public int Canton { get; set; }

        /// <summary>
        /// 行政区名称
        /// </summary>
        public string CantonName { get; set; }

        /// <summary>
        /// 我的携程2.0项目使用：Onilne我的携程中是否可见：T 可见，F不可见；默认可见
        /// </summary>
        public string ShowToCustomer { get; set; }

        /// <summary>
        /// 限额抵用券使用总额
        /// </summary>
        public decimal LimitedEMoneyAmount { get; set; }

        /// <summary>
        /// 不限额抵用券使用总额
        /// </summary>
        public decimal UnlimitedEMoneyAmount { get; set; }

        /// <summary>
        /// 订单下单渠道ID
        /// </summary>
        public int DistributionChannelID { get; set; }

        /// <summary>
        /// 折扣金额
        /// </summary>
        public decimal DiscountAmount { get; set; }

        /// <summary>
        /// 订单售卖模式：0-产品售卖、1-套餐打包售卖（自行行、机酒）、2-资源裸卖
        /// </summary>
        public int OrderSaleMode { get; set; }

        /// <summary>
        /// 用户最终付款金额
        /// </summary>
        public decimal TotalAmount { get; set; }

        /// <summary>
        /// 实际收款金额
        /// </summary>
        public decimal ActualAmount { get; set; }

        /// <summary>
        /// 卖价调整金额
        /// </summary>
        public decimal AdjustAmount { get; set; }

        /// <summary>
        /// 是否锁定：0=未锁定 1=已锁定
        /// </summary>
        public bool IsLock { get; set; }

        /// <summary>
        /// 锁定类型：NON=未锁定 COA=用户操作申请
        /// </summary>
        public string LockType { get; set; }

        /// <summary>
        /// 临时订单号
        /// </summary>
        public string TempOrderId { get; set; }

        /// <summary>
        /// 临时订单号
        /// </summary>
        public string Language { get; set; }

        /// <summary>
        /// 渠道名称
        /// </summary>
        public string DistributionChannelName { get; set; }

        /// <summary>
        /// 支付类型 0 预付； 1 现付 
        /// </summary>
        public string PayMode { get; set; }

        /// <summary>
        /// 是否给客户返现
        /// </summary>
        public string CanRebate { get; set; }

        /// <summary>
        /// 订单支付流水号
        /// </summary>
        public string ExternalNo { get; set; }

        /// <summary>
        /// 是否自动处理
        /// </summary>
        public string IsAutoProcess { get; set; }

        /// <summary>
        /// 母订单号
        /// </summary>
        public string ParentOrderId { get; set; }
        /// <summary>
        /// 订单来源
        /// </summary>
        public int OrderSource { get; set; }

        /// <summary>
        /// 客户IP
        /// </summary>
        public string ClientIP { get; set; }

        /// <summary>
        /// 目的地类别
        /// </summary>
        public int DestinationType { get; set; }


    }

    /// <summary>
    /// 订单基本信息接口
    /// </summary>
    public interface IOrderBaseInfoDTO
    {
        /// <summary>
        /// 订单号
        /// </summary>
        long OrderId { get; set; }

        /// <summary>
        /// 预订日期
        /// </summary>
        DateTime OrderDate { get; set; }

        /// <summary>
        /// 订单简述
        /// </summary>
        string OrderName { get; set; }

        /// <summary>
        /// 订单总卖价，包含订单已收已付之前手动产生的卖价调整金额，不包含订单已收已付之后系统自动产生的卖价调整金额
        /// </summary>
        decimal Amount { get; set; }

        /// <summary>
        /// 送票费用
        /// </summary>
        decimal SendTicketFee { get; set; }

        /// <summary>
        /// 订单使用的游票金额
        /// </summary>
        decimal TMoney { get; set; }

        /// <summary>
        /// 最早使用日期
        /// </summary>
        DateTime UseDateOfFirst { get; set; }

        /// <summary>
        /// 最晚使用日期
        /// </summary>
        DateTime? UseDateOfLast { get; set; }

        /// <summary>
        /// 登录用户名
        /// </summary>
        string Uid { get; set; }

        /// <summary>
        /// 订单确认方式1001：不需要确认 1002：手机短信确认 1003：电话确认 1004 Email确认
        /// </summary>
        int ConfirmWay { get; set; }

        /// <summary>
        /// Ctrip卡号
        /// </summary>
        string CtripCardNo { get; set; }

        /// <summary>
        /// 人数
        /// </summary>
        int Quantity { get; set; }

        /// <summary>
        /// 联系人确认方式 NON=不用确认 CSM=短信确认 TEL=电话确认 EML=邮件确认 FAX=传真确认
        /// </summary>
        string ConfirmType { get; set; }

        /// <summary>
        /// 联系人名字
        /// </summary>
        string ContactName { get; set; }

        /// <summary>
        /// 联系人电话
        /// </summary>
        string ContactTel { get; set; }

        /// <summary>
        /// 联系人传真
        /// </summary>
        string ContactFax { get; set; }

        /// <summary>
        /// 联系人手机
        /// </summary>
        string ContactMobile { get; set; }

        /// <summary>
        /// 联系人Email
        /// </summary>
        string ContactEmail { get; set; }

        /// <summary>
        /// 联系人地址
        /// </summary>
        string ContactAddress { get; set; }

        /// <summary>
        /// 取票方式 SND=市内配送 NUL=不取不送 JOU=邮寄行程单 EMS GET=市内自取
        /// </summary>
        string GetTicketType { get; set; }

        /// <summary>
        /// 备注
        /// </summary>
        string Remarks { get; set; }

        /// <summary>
        /// 送票时间开始
        /// </summary>
        DateTime SendTicketETime { get; set; }

        /// <summary>
        /// 送票时间结束
        /// </summary>
        DateTime SendTicketLTime { get; set; }

        /// <summary>
        /// 客户等级 0=普通 10=金牌 20=白金 30=钻石
        /// </summary>
        int VipGrade { get; set; }

        /// <summary>
        /// 卖价币种
        /// </summary>
        string Currency { get; set; }

        /// <summary>
        /// 最晚回复时间
        /// </summary>
        DateTime ClientConfirmDueDate { get; set; }

        /// <summary>
        /// EMS邮编
        /// </summary>
        string ContactZipCode { get; set; }

        /// <summary>
        /// 行政区
        /// </summary>
        int Canton { get; set; }

        /// <summary>
        /// 行政区名称
        /// </summary>
        string CantonName { get; set; }

        /// <summary>
        /// 我的携程2.0项目使用：Onilne我的携程中是否可见：T 可见，F不可见；默认可见
        /// </summary>
        string ShowToCustomer { get; set; }

        /// <summary>
        /// 限额抵用券使用总额
        /// </summary>
        decimal LimitedEMoneyAmount { get; set; }

        /// <summary>
        /// 不限额抵用券使用总额
        /// </summary>
        decimal UnlimitedEMoneyAmount { get; set; }

        /// <summary>
        /// 订单下单渠道ID
        /// </summary>
        int DistributionChannelID { get; set; }

        /// <summary>
        /// 折扣金额
        /// </summary>
        decimal DiscountAmount { get; set; }

        /// <summary>
        /// 订单售卖模式：0-产品售卖、1-套餐打包售卖（自行行、机酒）、2-资源裸卖
        /// </summary>
        int OrderSaleMode { get; set; }

        /// <summary>
        /// 用户最终付款金额
        /// </summary>
        decimal TotalAmount { get; set; }

        /// <summary>
        /// 实际收款金额
        /// </summary>
        decimal ActualAmount { get; set; }

        /// <summary>
        /// 卖价调整金额
        /// </summary>
        decimal AdjustAmount { get; set; }

        /// <summary>
        /// 是否锁定：0=未锁定 1=已锁定
        /// </summary>
        bool IsLock { get; set; }

        /// <summary>
        /// 锁定类型：NON=未锁定 COA=用户操作申请
        /// </summary>
        string LockType { get; set; }

        /// <summary>
        /// 临时订单号
        /// </summary>
        string TempOrderId { get; set; }

        /// <summary>
        /// 临时订单号
        /// </summary>
        string Language { get; set; }

        /// <summary>
        /// 渠道名称
        /// </summary>
        string DistributionChannelName { get; set; }

        /// <summary>
        /// 支付类型 0 预付； 1 现付 
        /// </summary>
        string PayMode { get; set; }

        /// <summary>
        /// 订单支付流水号
        /// </summary>
        string ExternalNo { get; set; }

        /// <summary>
        /// 是否返现
        /// </summary>
        bool CanRebate { get; set; }

        /// <summary>
        /// 是否自动处理
        /// </summary>
        bool IsAutoProcess { get; set; }

        /// <summary>
        /// 母订单号
        /// </summary>
        string ParentOrderId { get; set; }
        /// <summary>
        /// 订单来源
        /// </summary>
        int OrderSource { get; set; }
        /// <summary>
        /// 客户IP
        /// </summary>
        string ClientIP { get; set; }

        /// <summary>
        /// 目的地类别
        /// </summary>
        int DestinationType { get; set; }
    }
    /// <summary>
    /// 订单基本信息DTO
    /// </summary>
    public class OrderBaseInfoDTO : IOrderBaseInfoDTO
    {

        public long OrderId
        {
            get;
            set;
        }

        public DateTime OrderDate
        {
            get;
            set;
        }

        public string OrderName
        {
            get;
            set;
        }

        public decimal Amount
        {
            get;
            set;
        }

        public decimal SendTicketFee
        {
            get;
            set;
        }

        public decimal TMoney
        {
            get;
            set;
        }

        public DateTime UseDateOfFirst
        {
            get;
            set;
        }



        public DateTime? UseDateOfLast
        {
            get;

            set;
        }

        public string Uid
        {
            get;
            set;
        }

        public int ConfirmWay
        {
            get;
            set;
        }

        public string CtripCardNo
        {
            get;
            set;
        }

        public int Quantity
        {
            get;
            set;
        }

        public string ConfirmType
        {
            get;
            set;
        }

        public string ContactName
        {
            get;
            set;
        }

        public string ContactTel
        {
            get;
            set;
        }

        public string ContactFax
        {
            get;
            set;
        }

        public string ContactMobile
        {
            get;
            set;
        }

        public string ContactEmail
        {
            get;
            set;
        }

        public string ContactAddress
        {
            get;
            set;
        }

        public string GetTicketType
        {
            get;
            set;
        }

        public string Remarks
        {
            get;
            set;
        }

        public DateTime SendTicketETime
        {
            get;
            set;
        }

        public DateTime SendTicketLTime
        {
            get;
            set;
        }

        public int VipGrade
        {
            get;
            set;
        }

        public string Currency
        {
            get;
            set;
        }

        public DateTime ClientConfirmDueDate
        {
            get;
            set;
        }

        public string ContactZipCode
        {
            get;
            set;
        }

        public int Canton
        {
            get;
            set;
        }

        public string CantonName
        {
            get;
            set;
        }

        public string ShowToCustomer
        {
            get;
            set;
        }

        public decimal LimitedEMoneyAmount
        {
            get;
            set;
        }

        public decimal UnlimitedEMoneyAmount
        {
            get;
            set;
        }

        public int DistributionChannelID
        {
            get;
            set;
        }

        public decimal DiscountAmount
        {
            get;
            set;
        }

        public int OrderSaleMode
        {
            get;
            set;
        }

        public decimal TotalAmount
        {
            get;
            set;
        }

        public decimal ActualAmount
        {
            get;
            set;
        }

        public decimal AdjustAmount
        {
            get;
            set;
        }

        public bool IsLock
        {
            get;
            set;
        }

        public string LockType
        {
            get;
            set;
        }

        public string TempOrderId
        {
            get;
            set;
        }


        public string Language { get; set; }

        public string DistributionChannelName { get; set; }

        public string PayMode { get; set; }

        public string ExternalNo { get; set; }


        public bool CanRebate
        {
            get;
            set;
        }

        public bool IsAutoProcess { get; set; }

        /// <summary>
        /// 母订单号
        /// </summary>
        public string ParentOrderId { get; set; }
        /// <summary>
        /// 订单来源
        /// </summary>
        public int OrderSource { get; set; }
        /// <summary>
        /// 客户IP
        /// </summary>
        public string ClientIP { get; set; }

        /// <summary>
        /// 目的地类别
        /// </summary>
        public int DestinationType { get; set; }

    }
}
